package com.ConfigServer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ConfigServer.entity.PropertyEntity;
import com.ConfigServer.service.ConfigRepositoryService;

@RestController
public class ConfigController {
	@Autowired
	private ConfigRepositoryService configRepositoryService;
	//向其它服务器提供接口，返回更新的配置内容，可以是增量也可以是全量，全量实现起来更简单
	@RequestMapping(value = "/properties", method = RequestMethod.GET)
	public PropertyEntity properties(@RequestParam String application,
			@RequestParam String profile,@RequestParam String label) {
		return configRepositoryService.getProperties(application, profile, label);
	}
	
	@RequestMapping(value = "/testTransactional", method = RequestMethod.GET)
	public void testTransactional(@RequestParam String value) {
		configRepositoryService.testTransactional(value);
	}
	
}
